package org.rambadger.command.event;

import org.rambadger.command.validation.UrlIdentifier;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

//TODO: Document
public class AssignmentMovedWithinTrack implements Serializable {
    private static final long serialVersionUID = 3623067429943311737L;

    //Compound Key {
    private final String platformId;
    private final String assignmentId;
    //}
    //Compound Key {
    //private final String platformId;
    private final String trackId;
    //}

    private final int index;

    public AssignmentMovedWithinTrack(String platformId, String assignmentId, String trackId, int index) {
        this.platformId = platformId;
        this.assignmentId = assignmentId;
        this.trackId = trackId;
        this.index = index;
    }

    @UrlIdentifier
    @NotNull
    public String getPlatformId() {
        return platformId;
    }

    @UrlIdentifier @NotNull
    public String getAssignmentId() {
        return assignmentId;
    }

    @UrlIdentifier @NotNull
    public String getTrackId() {
        return trackId;
    }

    @Min(0)
    public int getIndex() {
        return index;
    }

    public String getFullAssignmentId() {
        return platformId+"/"+assignmentId;
    }

    public String getFullTrackId() {
        return platformId+"/"+trackId;
    }

    @Override
    public String toString() {
        return "AssignmentMovedWithinTrack{" +
                "platformId='" + platformId + '\'' +
                ", assignmentId='" + assignmentId + '\'' +
                ", trackId='" + trackId + '\'' +
                ", index=" + index +
                '}';
    }
}